/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.spring.modelo.entidad;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Ricardo
 */
@Entity
@Table(name = "Planes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Planes.findAll", query = "SELECT p FROM Planes p"),
    @NamedQuery(name = "Planes.findByCodPlan", query = "SELECT p FROM Planes p WHERE p.codPlan = :codPlan"),
    @NamedQuery(name = "Planes.findByFechaCreacion", query = "SELECT p FROM Planes p WHERE p.fechaCreacion = :fechaCreacion"),
    @NamedQuery(name = "Planes.findByVigente", query = "SELECT p FROM Planes p WHERE p.vigente = :vigente")})
public class Planes implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "planes")
    private Collection<DetallePlan> detallePlanCollection;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Column(name = "codPlan")
    private Integer codPlan;
    @Size(max = 10)
    @Column(name = "fechaCreacion")
    private String fechaCreacion;
    @Column(name = "vigente")
    private Boolean vigente;
    @JoinColumn(name = "codCarrera", referencedColumnName = "codCarrera")
    @ManyToOne
    private Carrera codCarrera;

    public Planes() {
    }

    public Planes(Integer codPlan) {
        this.codPlan = codPlan;
    }

    public Integer getCodPlan() {
        return codPlan;
    }

    public void setCodPlan(Integer codPlan) {
        this.codPlan = codPlan;
    }

    public String getFechaCreacion() {
        return fechaCreacion;
    }

    public void setFechaCreacion(String fechaCreacion) {
        this.fechaCreacion = fechaCreacion;
    }

    public Boolean getVigente() {
        return vigente;
    }

    public void setVigente(Boolean vigente) {
        this.vigente = vigente;
    }

    public Carrera getCodCarrera() {
        return codCarrera;
    }

    public void setCodCarrera(Carrera codCarrera) {
        this.codCarrera = codCarrera;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codPlan != null ? codPlan.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Planes)) {
            return false;
        }
        Planes other = (Planes) object;
        if ((this.codPlan == null && other.codPlan != null) || (this.codPlan != null && !this.codPlan.equals(other.codPlan))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.spring.modelo.entidad.Planes[ codPlan=" + codPlan + " ]";
    }

    @XmlTransient
    public Collection<DetallePlan> getDetallePlanCollection() {
        return detallePlanCollection;
    }

    public void setDetallePlanCollection(Collection<DetallePlan> detallePlanCollection) {
        this.detallePlanCollection = detallePlanCollection;
    }
    
}
